using UnityEngine;
using UnityEngine.EventSystems;
public class InfoSource : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
    public string icon;
    public string head;
    public string body;
    public string foot;

    public void OnPointerEnter(PointerEventData eventData)
    {
        InfoWindowManager.Instance.Open(this);
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        if (InfoWindowManager.Current == this)
        {
            InfoWindowManager.Instance.Close();
        }
    }
    private void OnDisable()
    {
        if (InfoWindowManager.Current == this)
        {
            InfoWindowManager.Instance.Close();
        }
    }
    private void OnDestroy()
    {
        if (InfoWindowManager.Current == this)
        {
            InfoWindowManager.Instance.Close();
        }
    }
}
